#!/usr/bin/env python
from google.appengine.ext.webapp import RequestHandler
from google.appengine.api import users

from templates import run, render, redirect
from models import UserActions

class Main(RequestHandler):

    def get(self):
        user = users.get_current_user()

        if user:
            redirect(self, "/home")
        else:
            ua = UserActions().all().order('-updated')
            render(self, 'index.html', values={'loglink': users.create_login_url("/"), 'loglabel': 'login', 'userActions': ua})

if __name__ == '__main__': run([('/', Main)])
